home *** CD-ROM | disk | FTP | other *** search
/ PC Users 8 / Cd Pc Users extra 8.iso / prog / inst / firstimp / vcimpres.z / ROTATE.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-11-07  |  6.8 KB  |  207 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BackColor       =   &H00C0C0C0&
  5.    BorderStyle     =   1  'Fixed Single
  6.    Caption         =   "First Impression Rotation Demo"
  7.    ClientHeight    =   5820
  8.    ClientLeft      =   1185
  9.    ClientTop       =   1575
  10.    ClientWidth     =   8265
  11.    BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  12.       Name            =   "MS Sans Serif"
  13.       Size            =   8.25
  14.       Charset         =   0
  15.       Weight          =   700
  16.       Underline       =   0   'False
  17.       Italic          =   0   'False
  18.       Strikethrough   =   0   'False
  19.    EndProperty
  20.    ForeColor       =   &H80000008&
  21.    Height          =   6225
  22.    Icon            =   "ROTATE.frx":0000
  23.    Left            =   1125
  24.    LinkTopic       =   "Form1"
  25.    MaxButton       =   0   'False
  26.    MinButton       =   0   'False
  27.    ScaleHeight     =   5820
  28.    ScaleWidth      =   8265
  29.    Top             =   1230
  30.    Width           =   8385
  31.    Begin VB.Frame Frame2 
  32.       Caption         =   " Options "
  33.       Height          =   1215
  34.       Left            =   5580
  35.       TabIndex        =   3
  36.       Top             =   3900
  37.       Width           =   2535
  38.       Begin VB.TextBox txtRotationDelta 
  39.          Height          =   285
  40.          Left            =   300
  41.          TabIndex        =   6
  42.          Text            =   "2"
  43.          Top             =   360
  44.          Width           =   375
  45.       End
  46.       Begin VB.CheckBox chkChangeElevation 
  47.          Caption         =   "Change Elevation"
  48.          Height          =   255
  49.          Left            =   480
  50.          TabIndex        =   4
  51.          Top             =   780
  52.          Value           =   1  'Checked
  53.          Width           =   1875
  54.       End
  55.       Begin VB.Label Label4 
  56.          Caption         =   "Rotation Delta"
  57.          Height          =   195
  58.          Left            =   780
  59.          TabIndex        =   5
  60.          Top             =   420
  61.          Width           =   1335
  62.       End
  63.    End
  64.    Begin VB.CommandButton cmdStart 
  65.       Appearance      =   0  'Flat
  66.       BackColor       =   &H80000005&
  67.       Caption         =   "Start Rotation"
  68.       Height          =   375
  69.       Left            =   5640
  70.       TabIndex        =   0
  71.       Top             =   5280
  72.       Width           =   2415
  73.    End
  74.    Begin VtChartLib.VtChart VtChart1 
  75.       Height          =   5415
  76.       Left            =   0
  77.       TabIndex        =   7
  78.       Top             =   120
  79.       Width           =   5295
  80.       _ExtentX        =   9340
  81.       _ExtentY        =   9551
  82.       _0              =   $"ROTATE.frx":030A
  83.       _1              =   $"ROTATE.frx":070F
  84.       _2              =   $"ROTATE.frx":0B14
  85.       _3              =   $"ROTATE.frx":0F19
  86.       _4              =   $"ROTATE.frx":131E
  87.       _5              =   $"ROTATE.frx":1723
  88.       _6              =   $"ROTATE.frx":1B28
  89.       _7              =   $"ROTATE.frx":1F2E
  90.       _8              =   $"ROTATE.frx":2333
  91.       _9              =   $"ROTATE.frx":2738
  92.       _10             =   $"ROTATE.frx":2B3D
  93.       _11             =   $"ROTATE.frx":2F42
  94.       _12             =   $"ROTATE.frx":3347
  95.       _13             =   $"ROTATE.frx":374C
  96.       _14             =   $"ROTATE.frx":3B52
  97.       _count          =   15
  98.       _ver            =   1
  99.    End
  100.    Begin VB.Label Label3 
  101.       Alignment       =   2  'Center
  102.       Caption         =   "Press Escape to stop."
  103.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  104.          Name            =   "Arial"
  105.          Size            =   9.75
  106.          Charset         =   0
  107.          Weight          =   700
  108.          Underline       =   0   'False
  109.          Italic          =   0   'False
  110.          Strikethrough   =   0   'False
  111.       EndProperty
  112.       ForeColor       =   &H000000C0&
  113.       Height          =   255
  114.       Left            =   5580
  115.       TabIndex        =   2
  116.       Top             =   2820
  117.       Visible         =   0   'False
  118.       Width           =   2535
  119.    End
  120.    Begin VB.Label Label2 
  121.       Alignment       =   2  'Center
  122.       Caption         =   "First Impression Real-Time Rotation"
  123.       BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  124.          Name            =   "Times New Roman"
  125.          Size            =   24
  126.          Charset         =   0
  127.          Weight          =   700
  128.          Underline       =   0   'False
  129.          Italic          =   0   'False
  130.          Strikethrough   =   0   'False
  131.       EndProperty
  132.       Height          =   2235
  133.       Left            =   5520
  134.       TabIndex        =   1
  135.       Top             =   120
  136.       Width           =   2655
  137.    End
  138. Attribute VB_Name = "Form1"
  139. Attribute VB_Creatable = False
  140. Attribute VB_Exposed = False
  141. Option Explicit
  142. Dim StillGoing%
  143. Private Sub chkChangeElevation_Click()
  144.    cmdStart.SetFocus
  145. End Sub
  146. Private Sub cmdStart_KeyDown(KeyCode As Integer, Shift As Integer)
  147.     If KeyCode = 27 Then
  148.         StillGoing = False
  149.     Else
  150.         KeyCode = 0
  151.     End If
  152. End Sub
  153. Private Sub cmdStart_Click()
  154.    Dim elevation!, rotation!, rot!, rotationDegrees!
  155.    Dim theView As Object
  156.    ' Put chart in Blit mode
  157.    VtChart1.DrawMode = VtChDrawModeBlit
  158.    ' Store a pointer to the view to minimize
  159.    ' traversing the object hierarchy
  160.    ' Get the rotation amount
  161.    rotationDegrees = Val(txtRotationDelta.Text)
  162.    If rotationDegrees < 1 Or rotationDegrees > 90 Then
  163.        MsgBox "Rotation must be between 1 and 90 degrees."
  164.        Exit Sub
  165.    End If
  166.    ' Keep going as long as this flag is True
  167.    StillGoing = True
  168.    Label3.Visible = True
  169.    cmdStart.SetFocus
  170.    ' Rotate the chart
  171.    rotation = 0
  172.    Do While StillGoing
  173.        If chkChangeElevation = 1 Then
  174.            rot = rotation Mod 180
  175.            elevation = IIf(rot <= 90, rot, 90 - (rot - 90))
  176.        Else
  177.            elevation = 30
  178.        End If
  179.        
  180.        VtChart1.Plot.View3d.Set rotation, elevation
  181.        
  182.        DoEvents ' Allow for the Escape key to get through
  183.        
  184.        ' Rotate through 360 degrees
  185.        rotation = rotation + rotationDegrees
  186.        If rotation >= 360 Then rotation = 0
  187.    Loop
  188.    Form1.Label3.Visible = False
  189. End Sub
  190. Private Sub Form_KeyPress(KeyAscii As Integer)
  191.     Dim RDegrees As Integer
  192.     If KeyAscii = 13 Then
  193.         RDegrees = Val(txtRotationDelta.Text)
  194.         If RDegrees < 1 Or RDegrees > 90 Then
  195.             MsgBox "Rotation must be between 1 and 90 degrees."
  196.         End If
  197.         KeyAscii = 0
  198.     End If
  199. End Sub
  200. Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
  201. End Sub
  202. Private Sub txtRotationDelta_KeyDown(KeyCode As Integer, Shift As Integer)
  203.    If StillGoing Then
  204.       cmdStart.SetFocus
  205.    End If
  206. End Sub
  207.